package com.qf.flash.mvp.presenter;

import com.qf.flash.http.HttpManager;
import com.qf.flash.model.GameGroupBean;
import com.qf.flash.model.LifeFunBean;
import com.qf.flash.mvp.contract.LifeFunContract;
import com.qf.flashlib.base.BasePresenter;
import com.qf.flashlib.base.BaseResponse;
import com.qf.flashlib.base.BaseSubscriber;
import com.qf.flashlib.util.RxUtils;

import java.util.List;


public class LifeFunPresenter extends BasePresenter<LifeFunContract.View> implements LifeFunContract.Presenter {
    @Override
    public void getLifeList(String type, int pageNo, int pageSize) {
        addSubscription(HttpManager.getInstance().getGsonHttpApi()
                .GET_LIFE_LIST(type, pageNo, pageSize)
                .compose(RxUtils.handleBaseResult())
                .compose(RxUtils.io_main())
                .subscribeWith(new BaseSubscriber<BaseResponse<List<LifeFunBean>>>(mRootView, false) {
                    @Override
                    public void onSuccess(BaseResponse<List<LifeFunBean>> game) {
                        mRootView.setLifeListData(game.getData(), game.getTotalPage());
                    }
                })
        );
    }


}
